package com.thinktank.controller;

import static com.thinktank.util.DbUtil.*;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.thinktank.dao.*;

public class GuestDeleteController implements Controller  {
	public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 정보 받고 DB 작업하고 에러면 error.jsp로
		String gNo = request.getParameter("gNo");
		Connection con = getConnection();
		GuestDao dao = new GuestDao(con);

		int result = dao.delete(gNo);
		close(con);
		
		if(result == 0)		return "error.jsp";
		else 				return "redirect:guest_main.do";
	}
}
